<extend name="template/base_index" />

<block name="area_header">
<style type="text/css">
	textarea{resize: none;}
</style>
</block>

<block name="area_body">
	{:W('Menus/topbar')}
	<div class="admin-main container-fluid">
		{:W('Menus/left')}
		<div class="admin-main-content">
			{:W('Menus/breadcrumb')}
			<h3>帖子管理</h3>
			<div class="member_access">
				<blockquote><p class="text-primary">论坛帖子管理</p></blockquote>
				<form method="post" class="form-inline searchForm" action="{:U('Admin/BbsForumPost/index')}">
					<div class="form-group">
						<label>状态</label>
						<select class="form-control input-short input-sm select_status" name="status">
                <option class="status" value="-2">全部</option>
                <option class="status" value="1">待审核</option>
                <option class="status" value="0">正常</option>
                <option class="status" value="-1">已删除</option>
            </select>
					</div>
					帖子ID:<input type="text" class="form-control input-short input-sm" name="tid" value="{$tid}">
					<input type="submit" class="btn btn-sm" value="查找">
				</form>
				<div class="form-control-static">
					<a href="{:U(CONTROLLER_NAME .'/bulkDeletePost')}" class="confirm ajax-post btn btn-danger btn-sm confirm" target-form="selectitem">删除选中项</a>
					<a href="{:U(CONTROLLER_NAME .'/bulkDeletePost',array('status'=>0))}" class="btn btn-success btn-sm ajax-post confirm" target-form="selectitem">通过选中项</a>
          <a href="{:U(CONTROLLER_NAME .'/bulkDeletePost',array('status'=>1))}" class="btn btn-primary btn-sm ajax-post confirm" target-form="selectitem">重审选中项</a>
				</div>
				<table class="table table-striped table table-hover  table-condensed">
					<thead>
					<tr>
						<th>
							<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');">
							PID
						</th>
						<th>
							帖子标题(点击查看帖子详情)
						</th>
						<th>
							回复内容
						</th>
						<th>
							回复时间
						</th>
						<th>
							是否审核
						</th>
						<th>
							回复详情
						</th>
					</tr>
					</thead>
					<tbody>
					<empty name="list">
						<tr>
							<td colspan="7" class="text-center">{:L('NO_DATA')}</td>
						</tr>
						<else/>
						<volist name="list" id="vo">
							<tr>
								<td>
									<input type="checkbox" value="{$vo.pid}" name="ids[]" class="selectitem">
									{$vo.pid}</td>
								<td>[{$vo['tid']}:{$vo['position']+1}楼] <a href="{:U('Admin/BbsThread/view',array('tid'=>$vo['tid'],'activesubmenuid'=>309))}" title="{$vo.subject}">{$vo.subject|msubstr=0,20,'UTF-8',true}</a>
								</td>
								<td>{$vo.message|msubstr=0,50,'UTF-8',true}</td>
								<td>{$vo.dateline|date="Y-m-d H:i:s",###}</td>
								<td>
									<form action="" class="forum{$vo['pid']}"><input type="hidden" name="pid" value="{$vo['pid']}"></form>
                  <if condition="$vo.status eq 1" >待审核
                  <a href="{:U('Admin/BbsForumPost/delete',array('status'=>0))}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-success">通过</a>
                  <a href="{:U('Admin/BbsForumPost/delete')}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-danger">删除</a>
                  <elseif condition="$vo.status eq 0" />正常
                  <a href="{:U('Admin/BbsForumPost/delete',array('status'=>1))}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-primary">重审</a>
                  <a href="{:U('Admin/BbsForumPost/delete')}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-danger">删除</a>
                  <elseif condition="$vo.status eq -1" />已删除
                  <a href="{:U('Admin/BbsForumPost/delete',array('status'=>0))}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-success">通过</a>
                  <a href="{:U('Admin/BbsForumPost/delete',array('status'=>1))}" target-form="forum{$vo['pid']}" class="ajax-post btn btn-sm btn-primary">重审</a>
                  <else />未知
                  </if>
								</td>
								<td>
									<a href="{:U(CONTROLLER_NAME .'/detail',array('pid'=>$vo['pid']))}" class="btn btn-primary btn-sm" >详情</a>
								</td>
							</tr>

						</volist>
					</empty>
					</tbody>
				</table>
				<div>{$show}</div>
			</div>
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
</block>

<block name="area_footer">
<script type="text/javascript">
    $(function(){
        $('.select_status').val({$status});
        $("select[name='status']").change(function(){
            $('.searchForm').submit();
        });
    });
</script>
</block>
